package 蓝桥真题;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class K倍区间 {
       static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
       final static int N=100010;
       static long a[]=new long[N],n,k;
       
       public static void main(String[] ss) throws IOException {
		      ss=br.readLine().split(" ");
		      n=Integer.parseInt(ss[0]);k=Integer.parseInt(ss[1]);
		      for(int i=1;i<=n;i++){
		    	  a[i]=Integer.parseInt(br.readLine());
		    	  a[i]=a[i-1]+a[i];
		      }
		      long res=0;
		      for(int i=1;i<=n;i++)
		    	  for(int j=i;j<=n;j++){
		    		  if((a[j]-a[i-1])%k==0)res++;
		    	  }
		      System.out.print(res);
		      
	}
       
}
